package com.example.qxfw.cshx.service.impl;

import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.example.qxfw.common.entity.zy.CshxZsyb;
import com.example.qxfw.cshx.mapper.CshxZsybMapper;
import com.example.qxfw.cshx.service.CshxZsybService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.sql.Timestamp;
import java.util.List;

@Service
public class CshxZsybServiceImpl implements CshxZsybService {

    @Autowired
    private CshxZsybMapper cshxZsybMapper;

    @Override
    public String getForcastDate() {
        return cshxZsybMapper.selectForecastDate();
    }

    @Override
    public List<String> getStationName(String dxMin, String dxMax, String dyMin, String dyMax, String forcastdate) {
        return cshxZsybMapper.selectStationName(dxMin, dxMax, dyMin, dyMax, forcastdate);
    }

    @Override
    public List<CshxZsyb> getList(String forcastDate, String stationIds) {
        return cshxZsybMapper.selectList1(forcastDate,stationIds);
    }

    @Override
    public Integer delete(String forcastDate) {
        return cshxZsybMapper.delete(Wrappers.<CshxZsyb>lambdaQuery().eq(CshxZsyb::getForcastdate, Timestamp.valueOf(forcastDate)));
    }

    @Override
    public Integer save(CshxZsyb cshxZsyb) {
        return cshxZsybMapper.insert(cshxZsyb );
    }
}
